import { BasicColumn, FormSchema } from '@/components/Table';
import { h, ref } from 'vue';
import { Tag } from 'ant-design-vue';
import {VxeFormItemProps, VxeGridPropTypes} from "@/components/VxeTable";
import util from "@/utils/util";
import { deptSelectList } from '@/api/sys/iot';


/**
 */
export const vxeTableColumns: VxeGridPropTypes.Columns = [
  {
    title: '模式名称',
    field: 'name',
    showOverflow: 'title',
    align: 'center',
  },
  {
    title: '亮灯颜色',
    field: 'lights',
    showOverflow: 'title',
    // width: 130,
    align: 'center',
  },
  {
    title: '亮灯时长-秒',
    field: 'second',
    align: 'center',
    width: 120,
  },
  {
    title: '亮灯算法',
    field: 'lightMode',
    align: 'center',
    formatter: ({ cellValue, row, column }) => {
      let val = "";
      switch (cellValue) {
        case 0:
          val = "单个首选";
          break;
        case 1:
          val = "多个并行";
          break;
        case 2:
          val = "位置计算";
          break;
      }
      return val;
    },
    width: 120,
  },
  {
    title: '备注',
    field: 'remark',
    align: 'center',
    width: 120,
  },

  {
    title: '创建时间',
    field: 'createTime',
    width: 130,
    align: 'center',
  },

  // {
  //   width: 120,
  //   title: '操作',
  //   align: 'center',
  //   field: '',
  //   slots: { default: 'action' },
  //   fixed: 'right',
  // },
];




export const vxeTableFormSchema: VxeFormItemProps[] = [
  {
    span: 5,
    field: 'name',
    title: '搜索',
    itemRender: {
      props: {
        placeholder: '名称',
      },
      name: 'AInput',
    },
  },

  {
    span: 5,
    itemRender: {
      name: 'VxeButtonGroup',
      options: [
        { type: 'reset', content: '重置' },
        { type: 'submit', content: '查询', status: 'primary' },
      ],
    },
  },
];


export const formSchema: FormSchema[] = [

  {
    field: 'name',
    label: '模式名称',
    component:"Input",
    required: true,
  },
  {
    field: 'lights',
    label: '亮灯颜色',
    component:"Input",
    required: true,
  },

  {
    field: 'second',
    label: '亮灯时长-秒',
    component:"Input",
    required: false,
  },
  {
    field: 'lightMode',
    label: '亮灯算法',
    component:"Select",
    componentProps: {
      options: [
        { label: '单个首选', value: 0 },
        { label: '多个并行', value: 1 },
        { label: '位置计算', value: 2 },
      ],
    },
    required: false,
  },
  {
    field: 'remark',
    label: '备注',
    component:"Input",
    required: false,
  },

];
